
import type { InputNumberInstance } from 'element-plus'

type UseElInputNumberProps<
  D extends Record<string, any>,
  P extends keyof Readonly<D>
> = UseFormItemProps<InputNumberInstance['$props'], D, P>

/**
 * el-input
 * @param prop item.prop
 * @param label item.label
 * @param props item的其他属性
 * @returns form-item-data
 */
export function useElInputNumber<
  T extends Record<string, any>,
  P extends keyof T
>(
  prop: P,
  label: string,
  props: UseElInputNumberProps<T, P> = {}
): FormItemProps<T, P> {
  return {
    prop,
    label,
    ...props,
    component: 'el-input-number'
  }
}
